<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
		<title>TMMemoryCache Class Reference</title>
		<meta id="xcode-display" name="xcode-display" content="render"/>
		<meta name="viewport" content="width=550" />
		<link rel="stylesheet" type="text/css" href="../css/styles.css" media="all" />
		<link rel="stylesheet" type="text/css" media="print" href="../css/stylesPrint.css" />
		<meta name="generator" content="appledoc 2.1 (build 840)" />
	</head>
	<body>
		<header id="top_header">
			<div id="library" class="hideInXcode">
				<h1><a id="libraryTitle" href="../index.html">TMCache </a></h1>
				<a id="developerHome" href="../index.html">Tumblr</a>
			</div>
			
			<div id="title" role="banner">
				<h1 class="hideInXcode">TMMemoryCache Class Reference</h1>
			</div>
			<ul id="headerButtons" role="toolbar">
				<li id="toc_button">
					<button aria-label="Show Table of Contents" role="checkbox" class="open" id="table_of_contents"><span class="disclosure"></span>Table of Contents</button>
				</li>
				<li id="jumpto_button" role="navigation">
					<select id="jumpTo">
	<option value="top">Jump To&#133;</option>
	
	<option value="overview">Overview</option>
	
	
	
	
	<option value="tasks">Tasks</option>
	
	
	
	
	
	<option value="properties">Properties</option>
	
	<option value="//api/name/ageLimit">&nbsp;&nbsp;&nbsp;&nbsp;ageLimit</option>
	
	<option value="//api/name/costLimit">&nbsp;&nbsp;&nbsp;&nbsp;costLimit</option>
	
	<option value="//api/name/didAddObjectBlock">&nbsp;&nbsp;&nbsp;&nbsp;didAddObjectBlock</option>
	
	<option value="//api/name/didEnterBackgroundBlock">&nbsp;&nbsp;&nbsp;&nbsp;didEnterBackgroundBlock</option>
	
	<option value="//api/name/didReceiveMemoryWarningBlock">&nbsp;&nbsp;&nbsp;&nbsp;didReceiveMemoryWarningBlock</option>
	
	<option value="//api/name/didRemoveAllObjectsBlock">&nbsp;&nbsp;&nbsp;&nbsp;didRemoveAllObjectsBlock</option>
	
	<option value="//api/name/didRemoveObjectBlock">&nbsp;&nbsp;&nbsp;&nbsp;didRemoveObjectBlock</option>
	
	<option value="//api/name/queue">&nbsp;&nbsp;&nbsp;&nbsp;queue</option>
	
	<option value="//api/name/removeAllObjectsOnEnteringBackground">&nbsp;&nbsp;&nbsp;&nbsp;removeAllObjectsOnEnteringBackground</option>
	
	<option value="//api/name/removeAllObjectsOnMemoryWarning">&nbsp;&nbsp;&nbsp;&nbsp;removeAllObjectsOnMemoryWarning</option>
	
	<option value="//api/name/totalCost">&nbsp;&nbsp;&nbsp;&nbsp;totalCost</option>
	
	<option value="//api/name/willAddObjectBlock">&nbsp;&nbsp;&nbsp;&nbsp;willAddObjectBlock</option>
	
	<option value="//api/name/willRemoveAllObjectsBlock">&nbsp;&nbsp;&nbsp;&nbsp;willRemoveAllObjectsBlock</option>
	
	<option value="//api/name/willRemoveObjectBlock">&nbsp;&nbsp;&nbsp;&nbsp;willRemoveObjectBlock</option>
	
	
	
	
	
	
	<option value="instance_methods">Instance Methods</option>
	
	<option value="//api/name/enumerateObjectsWithBlock:">&nbsp;&nbsp;&nbsp;&nbsp;- enumerateObjectsWithBlock:</option>
	
	<option value="//api/name/enumerateObjectsWithBlock:completionBlock:">&nbsp;&nbsp;&nbsp;&nbsp;- enumerateObjectsWithBlock:completionBlock:</option>
	
	<option value="//api/name/objectForKey:">&nbsp;&nbsp;&nbsp;&nbsp;- objectForKey:</option>
	
	<option value="//api/name/objectForKey:block:">&nbsp;&nbsp;&nbsp;&nbsp;- objectForKey:block:</option>
	
	<option value="//api/name/removeAllObjects">&nbsp;&nbsp;&nbsp;&nbsp;- removeAllObjects</option>
	
	<option value="//api/name/removeAllObjects:">&nbsp;&nbsp;&nbsp;&nbsp;- removeAllObjects:</option>
	
	<option value="//api/name/removeObjectForKey:">&nbsp;&nbsp;&nbsp;&nbsp;- removeObjectForKey:</option>
	
	<option value="//api/name/removeObjectForKey:block:">&nbsp;&nbsp;&nbsp;&nbsp;- removeObjectForKey:block:</option>
	
	<option value="//api/name/setObject:forKey:">&nbsp;&nbsp;&nbsp;&nbsp;- setObject:forKey:</option>
	
	<option value="//api/name/setObject:forKey:block:">&nbsp;&nbsp;&nbsp;&nbsp;- setObject:forKey:block:</option>
	
	<option value="//api/name/setObject:forKey:withCost:">&nbsp;&nbsp;&nbsp;&nbsp;- setObject:forKey:withCost:</option>
	
	<option value="//api/name/setObject:forKey:withCost:block:">&nbsp;&nbsp;&nbsp;&nbsp;- setObject:forKey:withCost:block:</option>
	
	<option value="//api/name/sharedCache">&nbsp;&nbsp;&nbsp;&nbsp;- sharedCache</option>
	
	<option value="//api/name/trimToCost:">&nbsp;&nbsp;&nbsp;&nbsp;- trimToCost:</option>
	
	<option value="//api/name/trimToCost:block:">&nbsp;&nbsp;&nbsp;&nbsp;- trimToCost:block:</option>
	
	<option value="//api/name/trimToCostByDate:">&nbsp;&nbsp;&nbsp;&nbsp;- trimToCostByDate:</option>
	
	<option value="//api/name/trimToCostByDate:block:">&nbsp;&nbsp;&nbsp;&nbsp;- trimToCostByDate:block:</option>
	
	<option value="//api/name/trimToDate:">&nbsp;&nbsp;&nbsp;&nbsp;- trimToDate:</option>
	
	<option value="//api/name/trimToDate:block:">&nbsp;&nbsp;&nbsp;&nbsp;- trimToDate:block:</option>
	
	
	
</select>
				</li>
			</ul>
		</header>
		<nav id="tocContainer" class="isShowingTOC">
			<ul id="toc" role="tree">
				
<li role="treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#overview">Overview</a></span></li>




<li role="treeitem" id="task_treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#tasks">Tasks</a></span><ul>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Core">Core</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Event Blocks">Event Blocks</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Shared Cache">Shared Cache</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Asynchronous Methods">Asynchronous Methods</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Synchronous Methods">Synchronous Methods</a></span></li>
	
</ul></li>





<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#properties">Properties</a></span><ul>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/ageLimit">ageLimit</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/costLimit">costLimit</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/didAddObjectBlock">didAddObjectBlock</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/didEnterBackgroundBlock">didEnterBackgroundBlock</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/didReceiveMemoryWarningBlock">didReceiveMemoryWarningBlock</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/didRemoveAllObjectsBlock">didRemoveAllObjectsBlock</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/didRemoveObjectBlock">didRemoveObjectBlock</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/queue">queue</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/removeAllObjectsOnEnteringBackground">removeAllObjectsOnEnteringBackground</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/removeAllObjectsOnMemoryWarning">removeAllObjectsOnMemoryWarning</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/totalCost">totalCost</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/willAddObjectBlock">willAddObjectBlock</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/willRemoveAllObjectsBlock">willRemoveAllObjectsBlock</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/willRemoveObjectBlock">willRemoveObjectBlock</a></span></li>
	
</ul></li>





<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#instance_methods">Instance Methods</a></span><ul>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/enumerateObjectsWithBlock:">enumerateObjectsWithBlock:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/enumerateObjectsWithBlock:completionBlock:">enumerateObjectsWithBlock:completionBlock:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/objectForKey:">objectForKey:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/objectForKey:block:">objectForKey:block:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/removeAllObjects">removeAllObjects</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/removeAllObjects:">removeAllObjects:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/removeObjectForKey:">removeObjectForKey:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/removeObjectForKey:block:">removeObjectForKey:block:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setObject:forKey:">setObject:forKey:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setObject:forKey:block:">setObject:forKey:block:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setObject:forKey:withCost:">setObject:forKey:withCost:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/setObject:forKey:withCost:block:">setObject:forKey:withCost:block:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/sharedCache">sharedCache</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/trimToCost:">trimToCost:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/trimToCost:block:">trimToCost:block:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/trimToCostByDate:">trimToCostByDate:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/trimToCostByDate:block:">trimToCostByDate:block:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/trimToDate:">trimToDate:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/trimToDate:block:">trimToDate:block:</a></span></li>
	
</ul></li>


			</ul>
		</nav>
		<article>
			<div id="contents" class="isShowingTOC" role="main">
				<a title="TMMemoryCache Class Reference" name="top"></a>
				<div class="main-navigation navigation-top">
					<ul>
	<li><a href="../index.html">Index</a></li>
	<li><a href="../hierarchy.html">Hierarchy</a></li>
</ul>
				</div>
				<div id="header">
					<div class="section-header">
						<h1 class="title title-header">TMMemoryCache Class Reference</h1>
					</div>		
				</div>
				<div id="container">	
					
					<div class="section section-specification"><table cellspacing="0"><tbody>
						<tr>
	<td class="specification-title">Inherits from</td>
	<td class="specification-value">NSObject</td>
</tr><tr>
	<td class="specification-title">Declared in</td>
	<td class="specification-value">TMMemoryCache.h</td>
</tr>
						</tbody></table></div>
					
					
					
					
					<div class="section section-overview">
						<a title="Overview" name="overview"></a>
						<h2 class="subtitle subtitle-overview">Overview</h2>
						<p><code>TMMemoryCache</code> is a fast, thread safe key/value store similar to <code>NSCache</code>. On iOS it will clear itself
automatically to reduce memory usage when the app receives a memory warning or goes into the background.</p>

<p>Access is natively asynchronous. Every method accepts a callback block that runs on a concurrent
<a href="#//api/name/queue">queue</a>, with cache writes protected by GCD barriers. Synchronous variations are provided.</p>

<p>All access to the cache is dated so the that the least-used objects can be trimmed first. Setting an
optional <a href="#//api/name/ageLimit">ageLimit</a> will trigger a GCD timer to periodically to trim the cache to that age.</p>

<p>Objects can optionally be set with a &ldquo;cost&rdquo;, which could be a byte count or any other meaningful integer.
Setting a <a href="#//api/name/costLimit">costLimit</a> will automatically keep the cache below that value with <a href="#//api/name/trimToCostByDate:">trimToCostByDate:</a>.</p>

<p>Values will not persist after application relaunch or returning from the background. See <a href="../Classes/TMCache.html">TMCache</a> for
a memory cache backed by a disk cache.</p>
					</div>
					
					
					
					
					
					<div class="section section-tasks">
						<a title="Tasks" name="tasks"></a>
						<h2 class="subtitle subtitle-tasks">Tasks</h2>
						
						
						<a title="Core" name="task_Core"></a>
						<h3 class="subsubtitle task-title">Core</h3>

						<ul class="task-list">
							<li>
	<span class="tooltip">
		<code><a href="#//api/name/queue">&nbsp;&nbsp;queue</a></code>
		<span class="tooltip"><p>A concurrent queue on which all work is done. It is exposed here so that it can be set to target some
other queue, such as a global concurrent queue with a priority other than the default.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/totalCost">&nbsp;&nbsp;totalCost</a></code>
		<span class="tooltip"><p>The total accumulated cost.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/costLimit">&nbsp;&nbsp;costLimit</a></code>
		<span class="tooltip"><p>The maximum cost allowed to accumulate before objects begin to be removed with <a href="#//api/name/trimToCostByDate:">trimToCostByDate:</a>.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/ageLimit">&nbsp;&nbsp;ageLimit</a></code>
		<span class="tooltip"><p>The maximum number of seconds an object is allowed to exist in the cache. Setting this to a value
greater than <code>0.0</code> will start a recurring GCD timer with the same period that calls <a href="#//api/name/trimToDate:">trimToDate:</a>.
Setting it back to <code>0.0</code> will stop the timer. Defaults to <code>0.0</code>.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/removeAllObjectsOnMemoryWarning">&nbsp;&nbsp;removeAllObjectsOnMemoryWarning</a></code>
		<span class="tooltip"><p>When <code>YES</code> on iOS the cache will remove all objects when the app receives a memory warning.
Defaults to <code>YES</code>.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/removeAllObjectsOnEnteringBackground">&nbsp;&nbsp;removeAllObjectsOnEnteringBackground</a></code>
		<span class="tooltip"><p>When <code>YES</code> on iOS the cache will remove all objects when the app enters the background.
Defaults to <code>YES</code>.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li>
						</ul>
						
						
						<a title="Event Blocks" name="task_Event Blocks"></a>
						<h3 class="subsubtitle task-title">Event Blocks</h3>

						<ul class="task-list">
							<li>
	<span class="tooltip">
		<code><a href="#//api/name/willAddObjectBlock">&nbsp;&nbsp;willAddObjectBlock</a></code>
		<span class="tooltip"><p>A block to be executed just before an object is added to the cache. This block will be excuted within
a barrier, i.e. all reads and writes are suspended for the duration of the block.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/willRemoveObjectBlock">&nbsp;&nbsp;willRemoveObjectBlock</a></code>
		<span class="tooltip"><p>A block to be executed just before an object is removed from the cache. This block will be excuted
within a barrier, i.e. all reads and writes are suspended for the duration of the block.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/willRemoveAllObjectsBlock">&nbsp;&nbsp;willRemoveAllObjectsBlock</a></code>
		<span class="tooltip"><p>A block to be executed just before all objects are removed from the cache as a result of <a href="#//api/name/removeAllObjects:">removeAllObjects:</a>.
This block will be excuted within a barrier, i.e. all reads and writes are suspended for the duration of the block.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/didAddObjectBlock">&nbsp;&nbsp;didAddObjectBlock</a></code>
		<span class="tooltip"><p>A block to be executed just after an object is added to the cache. This block will be excuted within
a barrier, i.e. all reads and writes are suspended for the duration of the block.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/didRemoveObjectBlock">&nbsp;&nbsp;didRemoveObjectBlock</a></code>
		<span class="tooltip"><p>A block to be executed just after an object is removed from the cache. This block will be excuted
within a barrier, i.e. all reads and writes are suspended for the duration of the block.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/didRemoveAllObjectsBlock">&nbsp;&nbsp;didRemoveAllObjectsBlock</a></code>
		<span class="tooltip"><p>A block to be executed just after all objects are removed from the cache as a result of <a href="#//api/name/removeAllObjects:">removeAllObjects:</a>.
This block will be excuted within a barrier, i.e. all reads and writes are suspended for the duration of the block.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/didReceiveMemoryWarningBlock">&nbsp;&nbsp;didReceiveMemoryWarningBlock</a></code>
		<span class="tooltip"><p>A block to be executed upon receiving a memory warning (iOS only) potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.
This block will be executed regardless of the value of <a href="#//api/name/removeAllObjectsOnMemoryWarning">removeAllObjectsOnMemoryWarning</a>. Defaults to <code>nil</code>.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/didEnterBackgroundBlock">&nbsp;&nbsp;didEnterBackgroundBlock</a></code>
		<span class="tooltip"><p>A block to be executed when the app enters the background (iOS only) potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.
This block will be executed regardless of the value of <a href="#//api/name/removeAllObjectsOnEnteringBackground">removeAllObjectsOnEnteringBackground</a>. Defaults to <code>nil</code>.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li>
						</ul>
						
						
						<a title="Shared Cache" name="task_Shared Cache"></a>
						<h3 class="subsubtitle task-title">Shared Cache</h3>

						<ul class="task-list">
							<li>
	<span class="tooltip">
		<code><a href="#//api/name/sharedCache">&ndash;&nbsp;sharedCache</a></code>
		<span class="tooltip"><p>A shared cache.</p></span>
	</span>
	
	
</li>
						</ul>
						
						
						<a title="Asynchronous Methods" name="task_Asynchronous Methods"></a>
						<h3 class="subsubtitle task-title">Asynchronous Methods</h3>

						<ul class="task-list">
							<li>
	<span class="tooltip">
		<code><a href="#//api/name/objectForKey:block:">&ndash;&nbsp;objectForKey:block:</a></code>
		<span class="tooltip"><p>Retrieves the object for the specified key. This method returns immediately and executes the passed
block after the object is available, potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/setObject:forKey:block:">&ndash;&nbsp;setObject:forKey:block:</a></code>
		<span class="tooltip"><p>Stores an object in the cache for the specified key. This method returns immediately and executes the
passed block after the object has been stored, potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/setObject:forKey:withCost:block:">&ndash;&nbsp;setObject:forKey:withCost:block:</a></code>
		<span class="tooltip"><p>Stores an object in the cache for the specified key and the specified cost. If the cost causes the total
to go over the <a href="#//api/name/costLimit">costLimit</a> the cache is trimmed (oldest objects first). This method returns immediately
and executes the passed block after the object has been stored, potentially in parallel with other blocks
on the <a href="#//api/name/queue">queue</a>.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/removeObjectForKey:block:">&ndash;&nbsp;removeObjectForKey:block:</a></code>
		<span class="tooltip"><p>Removes the object for the specified key. This method returns immediately and executes the passed
block after the object has been removed, potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/trimToDate:block:">&ndash;&nbsp;trimToDate:block:</a></code>
		<span class="tooltip"><p>Removes all objects from the cache that have not been used since the specified date.
This method returns immediately and executes the passed block after the cache has been trimmed,
potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/trimToCost:block:">&ndash;&nbsp;trimToCost:block:</a></code>
		<span class="tooltip"><p>Removes objects from the cache, costliest objects first, until the <a href="#//api/name/totalCost">totalCost</a> is below the specified
value. This method returns immediately and executes the passed block after the cache has been trimmed,
potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/trimToCostByDate:block:">&ndash;&nbsp;trimToCostByDate:block:</a></code>
		<span class="tooltip"><p>Removes objects from the cache, ordered by date (least recently used first), until the <a href="#//api/name/totalCost">totalCost</a> is below
the specified value. This method returns immediately and executes the passed block after the cache has been
trimmed, potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/removeAllObjects:">&ndash;&nbsp;removeAllObjects:</a></code>
		<span class="tooltip"><p>Removes all objects from the cache. This method returns immediately and executes the passed block after
the cache has been cleared, potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/enumerateObjectsWithBlock:completionBlock:">&ndash;&nbsp;enumerateObjectsWithBlock:completionBlock:</a></code>
		<span class="tooltip"><p>Loops through all objects in the cache within a memory barrier (reads and writes are suspended during the enumeration).
This method returns immediately.</p></span>
	</span>
	
	
</li>
						</ul>
						
						
						<a title="Synchronous Methods" name="task_Synchronous Methods"></a>
						<h3 class="subsubtitle task-title">Synchronous Methods</h3>

						<ul class="task-list">
							<li>
	<span class="tooltip">
		<code><a href="#//api/name/objectForKey:">&ndash;&nbsp;objectForKey:</a></code>
		<span class="tooltip"><p>Retrieves the object for the specified key. This method blocks the calling thread until the
object is available.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/setObject:forKey:">&ndash;&nbsp;setObject:forKey:</a></code>
		<span class="tooltip"><p>Stores an object in the cache for the specified key. This method blocks the calling thread until the object
has been set.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/setObject:forKey:withCost:">&ndash;&nbsp;setObject:forKey:withCost:</a></code>
		<span class="tooltip"><p>Stores an object in the cache for the specified key and the specified cost. If the cost causes the total
to go over the <a href="#//api/name/costLimit">costLimit</a> the cache is trimmed (oldest objects first). This method blocks the calling thread
until the object has been stored.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/removeObjectForKey:">&ndash;&nbsp;removeObjectForKey:</a></code>
		<span class="tooltip"><p>Removes the object for the specified key. This method blocks the calling thread until the object
has been removed.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/trimToDate:">&ndash;&nbsp;trimToDate:</a></code>
		<span class="tooltip"><p>Removes all objects from the cache that have not been used since the specified date.
This method blocks the calling thread until the cache has been trimmed.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/trimToCost:">&ndash;&nbsp;trimToCost:</a></code>
		<span class="tooltip"><p>Removes objects from the cache, costliest objects first, until the <a href="#//api/name/totalCost">totalCost</a> is below the specified
value. This method blocks the calling thread until the cache has been trimmed.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/trimToCostByDate:">&ndash;&nbsp;trimToCostByDate:</a></code>
		<span class="tooltip"><p>Removes objects from the cache, ordered by date (least recently used first), until the <a href="#//api/name/totalCost">totalCost</a> is below
the specified value. This method blocks the calling thread until the cache has been trimmed.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/removeAllObjects">&ndash;&nbsp;removeAllObjects</a></code>
		<span class="tooltip"><p>Removes all objects from the cache. This method blocks the calling thread until the cache has been cleared.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/enumerateObjectsWithBlock:">&ndash;&nbsp;enumerateObjectsWithBlock:</a></code>
		<span class="tooltip"><p>Loops through all objects in the cache within a memory barrier (reads and writes are suspended during the enumeration).
This method blocks the calling thread until all objects have been enumerated.</p></span>
	</span>
	
	
</li>
						</ul>
						
					</div>
					
					
					
					
					
					<div class="section section-methods">
						<a title="Properties" name="properties"></a>
						<h2 class="subtitle subtitle-methods">Properties</h2>
						
						<div class="section-method">
	<a name="//api/name/ageLimit" title="ageLimit"></a>
	<h3 class="subsubtitle method-title">ageLimit</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>The maximum number of seconds an object is allowed to exist in the cache. Setting this to a value
greater than <code>0.0</code> will start a recurring GCD timer with the same period that calls <a href="#//api/name/trimToDate:">trimToDate:</a>.
Setting it back to <code>0.0</code> will stop the timer. Defaults to <code>0.0</code>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (assign) NSTimeInterval ageLimit</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/costLimit" title="costLimit"></a>
	<h3 class="subsubtitle method-title">costLimit</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>The maximum cost allowed to accumulate before objects begin to be removed with <a href="#//api/name/trimToCostByDate:">trimToCostByDate:</a>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (assign) NSUInteger costLimit</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/didAddObjectBlock" title="didAddObjectBlock"></a>
	<h3 class="subsubtitle method-title">didAddObjectBlock</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>A block to be executed just after an object is added to the cache. This block will be excuted within
a barrier, i.e. all reads and writes are suspended for the duration of the block.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (copy) TMMemoryCacheObjectBlock didAddObjectBlock</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/didEnterBackgroundBlock" title="didEnterBackgroundBlock"></a>
	<h3 class="subsubtitle method-title">didEnterBackgroundBlock</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>A block to be executed when the app enters the background (iOS only) potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.
This block will be executed regardless of the value of <a href="#//api/name/removeAllObjectsOnEnteringBackground">removeAllObjectsOnEnteringBackground</a>. Defaults to <code>nil</code>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (copy) TMMemoryCacheBlock didEnterBackgroundBlock</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/didReceiveMemoryWarningBlock" title="didReceiveMemoryWarningBlock"></a>
	<h3 class="subsubtitle method-title">didReceiveMemoryWarningBlock</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>A block to be executed upon receiving a memory warning (iOS only) potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.
This block will be executed regardless of the value of <a href="#//api/name/removeAllObjectsOnMemoryWarning">removeAllObjectsOnMemoryWarning</a>. Defaults to <code>nil</code>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (copy) TMMemoryCacheBlock didReceiveMemoryWarningBlock</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/didRemoveAllObjectsBlock" title="didRemoveAllObjectsBlock"></a>
	<h3 class="subsubtitle method-title">didRemoveAllObjectsBlock</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>A block to be executed just after all objects are removed from the cache as a result of <a href="#//api/name/removeAllObjects:">removeAllObjects:</a>.
This block will be excuted within a barrier, i.e. all reads and writes are suspended for the duration of the block.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (copy) TMMemoryCacheBlock didRemoveAllObjectsBlock</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/didRemoveObjectBlock" title="didRemoveObjectBlock"></a>
	<h3 class="subsubtitle method-title">didRemoveObjectBlock</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>A block to be executed just after an object is removed from the cache. This block will be excuted
within a barrier, i.e. all reads and writes are suspended for the duration of the block.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (copy) TMMemoryCacheObjectBlock didRemoveObjectBlock</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/queue" title="queue"></a>
	<h3 class="subsubtitle method-title">queue</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>A concurrent queue on which all work is done. It is exposed here so that it can be set to target some
other queue, such as a global concurrent queue with a priority other than the default.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (readonly) dispatch_queue_t queue</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/removeAllObjectsOnEnteringBackground" title="removeAllObjectsOnEnteringBackground"></a>
	<h3 class="subsubtitle method-title">removeAllObjectsOnEnteringBackground</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>When <code>YES</code> on iOS the cache will remove all objects when the app enters the background.
Defaults to <code>YES</code>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (assign) BOOL removeAllObjectsOnEnteringBackground</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/removeAllObjectsOnMemoryWarning" title="removeAllObjectsOnMemoryWarning"></a>
	<h3 class="subsubtitle method-title">removeAllObjectsOnMemoryWarning</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>When <code>YES</code> on iOS the cache will remove all objects when the app receives a memory warning.
Defaults to <code>YES</code>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (assign) BOOL removeAllObjectsOnMemoryWarning</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/totalCost" title="totalCost"></a>
	<h3 class="subsubtitle method-title">totalCost</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>The total accumulated cost.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (readonly) NSUInteger totalCost</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/willAddObjectBlock" title="willAddObjectBlock"></a>
	<h3 class="subsubtitle method-title">willAddObjectBlock</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>A block to be executed just before an object is added to the cache. This block will be excuted within
a barrier, i.e. all reads and writes are suspended for the duration of the block.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (copy) TMMemoryCacheObjectBlock willAddObjectBlock</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/willRemoveAllObjectsBlock" title="willRemoveAllObjectsBlock"></a>
	<h3 class="subsubtitle method-title">willRemoveAllObjectsBlock</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>A block to be executed just before all objects are removed from the cache as a result of <a href="#//api/name/removeAllObjects:">removeAllObjects:</a>.
This block will be excuted within a barrier, i.e. all reads and writes are suspended for the duration of the block.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (copy) TMMemoryCacheBlock willRemoveAllObjectsBlock</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/willRemoveObjectBlock" title="willRemoveObjectBlock"></a>
	<h3 class="subsubtitle method-title">willRemoveObjectBlock</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>A block to be executed just before an object is removed from the cache. This block will be excuted
within a barrier, i.e. all reads and writes are suspended for the duration of the block.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>@property (copy) TMMemoryCacheObjectBlock willRemoveObjectBlock</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
					</div>
					
					
					
					
					
					<div class="section section-methods">
						<a title="Instance Methods" name="instance_methods"></a>
						<h2 class="subtitle subtitle-methods">Instance Methods</h2>
						
						<div class="section-method">
	<a name="//api/name/enumerateObjectsWithBlock:" title="enumerateObjectsWithBlock:"></a>
	<h3 class="subsubtitle method-title">enumerateObjectsWithBlock:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Loops through all objects in the cache within a memory barrier (reads and writes are suspended during the enumeration).
This method blocks the calling thread until all objects have been enumerated.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)enumerateObjectsWithBlock:(TMMemoryCacheObjectBlock)<em>block</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>block</em></dt>
			<dd><p>A block to be executed for every object in the cache.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	<div class="method-subsection discussion-section">
		<h4 class="method-subtitle">Discussion</h4>
		<div class="warning"><p><strong>Warning:</strong> Do not call this method within the event blocks (<a href="#//api/name/didReceiveMemoryWarningBlock">didReceiveMemoryWarningBlock</a>, etc.)
Instead use the asynchronous version, <a href="#//api/name/enumerateObjectsWithBlock:completionBlock:">enumerateObjectsWithBlock:completionBlock:</a>.</p></div>
	</div>
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/enumerateObjectsWithBlock:completionBlock:" title="enumerateObjectsWithBlock:completionBlock:"></a>
	<h3 class="subsubtitle method-title">enumerateObjectsWithBlock:completionBlock:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Loops through all objects in the cache within a memory barrier (reads and writes are suspended during the enumeration).
This method returns immediately.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)enumerateObjectsWithBlock:(TMMemoryCacheObjectBlock)<em>block</em> completionBlock:(TMMemoryCacheBlock)<em>completionBlock</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>block</em></dt>
			<dd><p>A block to be executed for every object in the cache.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>completionBlock</em></dt>
			<dd><p>An optional block to be executed concurrently when the enumeration is complete.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/objectForKey:" title="objectForKey:"></a>
	<h3 class="subsubtitle method-title">objectForKey:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Retrieves the object for the specified key. This method blocks the calling thread until the
object is available.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (id)objectForKey:(NSString *)<em>key</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>key</em></dt>
			<dd><p>The key associated with the object.</p></dd>
		</dl>
		
	</div>
	
	
	
	<div class="method-subsection return">
		<h4 class="method-subtitle parameter-title">Return Value</h4>
		<p>The object for the specified key.</p>
	</div>
	
	
	
	
	
	
	
	
	
	<div class="method-subsection see-also-section">
		<h4 class="method-subtitle">See Also</h4>
		<ul>
			
			<li><code><p><a href="#//api/name/objectForKey:block:">&ndash; objectForKey:block:</a></p></code></li>
			
		</ul>
	</div>
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/objectForKey:block:" title="objectForKey:block:"></a>
	<h3 class="subsubtitle method-title">objectForKey:block:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Retrieves the object for the specified key. This method returns immediately and executes the passed
block after the object is available, potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)objectForKey:(NSString *)<em>key</em> block:(TMMemoryCacheObjectBlock)<em>block</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>key</em></dt>
			<dd><p>The key associated with the requested object.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>block</em></dt>
			<dd><p>A block to be executed concurrently when the object is available.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/removeAllObjects" title="removeAllObjects"></a>
	<h3 class="subsubtitle method-title">removeAllObjects</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Removes all objects from the cache. This method blocks the calling thread until the cache has been cleared.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)removeAllObjects</code></div>

    
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/removeAllObjects:" title="removeAllObjects:"></a>
	<h3 class="subsubtitle method-title">removeAllObjects:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Removes all objects from the cache. This method returns immediately and executes the passed block after
the cache has been cleared, potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)removeAllObjects:(TMMemoryCacheBlock)<em>block</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>block</em></dt>
			<dd><p>A block to be executed concurrently after the cache has been cleared, or nil.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/removeObjectForKey:" title="removeObjectForKey:"></a>
	<h3 class="subsubtitle method-title">removeObjectForKey:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Removes the object for the specified key. This method blocks the calling thread until the object
has been removed.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)removeObjectForKey:(NSString *)<em>key</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>key</em></dt>
			<dd><p>The key associated with the object to be removed.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/removeObjectForKey:block:" title="removeObjectForKey:block:"></a>
	<h3 class="subsubtitle method-title">removeObjectForKey:block:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Removes the object for the specified key. This method returns immediately and executes the passed
block after the object has been removed, potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)removeObjectForKey:(NSString *)<em>key</em> block:(TMMemoryCacheObjectBlock)<em>block</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>key</em></dt>
			<dd><p>The key associated with the object to be removed.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>block</em></dt>
			<dd><p>A block to be executed concurrently after the object has been removed, or nil.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/setObject:forKey:" title="setObject:forKey:"></a>
	<h3 class="subsubtitle method-title">setObject:forKey:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Stores an object in the cache for the specified key. This method blocks the calling thread until the object
has been set.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)setObject:(id)<em>object</em> forKey:(NSString *)<em>key</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>object</em></dt>
			<dd><p>An object to store in the cache.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>key</em></dt>
			<dd><p>A key to associate with the object. This string will be copied.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection see-also-section">
		<h4 class="method-subtitle">See Also</h4>
		<ul>
			
			<li><code><p><a href="#//api/name/setObject:forKey:block:">&ndash; setObject:forKey:block:</a></p></code></li>
			
		</ul>
	</div>
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/setObject:forKey:block:" title="setObject:forKey:block:"></a>
	<h3 class="subsubtitle method-title">setObject:forKey:block:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Stores an object in the cache for the specified key. This method returns immediately and executes the
passed block after the object has been stored, potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)setObject:(id)<em>object</em> forKey:(NSString *)<em>key</em> block:(TMMemoryCacheObjectBlock)<em>block</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>object</em></dt>
			<dd><p>An object to store in the cache.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>key</em></dt>
			<dd><p>A key to associate with the object. This string will be copied.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>block</em></dt>
			<dd><p>A block to be executed concurrently after the object has been stored, or nil.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/setObject:forKey:withCost:" title="setObject:forKey:withCost:"></a>
	<h3 class="subsubtitle method-title">setObject:forKey:withCost:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Stores an object in the cache for the specified key and the specified cost. If the cost causes the total
to go over the <a href="#//api/name/costLimit">costLimit</a> the cache is trimmed (oldest objects first). This method blocks the calling thread
until the object has been stored.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)setObject:(id)<em>object</em> forKey:(NSString *)<em>key</em> withCost:(NSUInteger)<em>cost</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>object</em></dt>
			<dd><p>An object to store in the cache.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>key</em></dt>
			<dd><p>A key to associate with the object. This string will be copied.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>cost</em></dt>
			<dd><p>An amount to add to the <a href="#//api/name/totalCost">totalCost</a>.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/setObject:forKey:withCost:block:" title="setObject:forKey:withCost:block:"></a>
	<h3 class="subsubtitle method-title">setObject:forKey:withCost:block:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Stores an object in the cache for the specified key and the specified cost. If the cost causes the total
to go over the <a href="#//api/name/costLimit">costLimit</a> the cache is trimmed (oldest objects first). This method returns immediately
and executes the passed block after the object has been stored, potentially in parallel with other blocks
on the <a href="#//api/name/queue">queue</a>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)setObject:(id)<em>object</em> forKey:(NSString *)<em>key</em> withCost:(NSUInteger)<em>cost</em> block:(TMMemoryCacheObjectBlock)<em>block</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>object</em></dt>
			<dd><p>An object to store in the cache.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>key</em></dt>
			<dd><p>A key to associate with the object. This string will be copied.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>cost</em></dt>
			<dd><p>An amount to add to the <a href="#//api/name/totalCost">totalCost</a>.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>block</em></dt>
			<dd><p>A block to be executed concurrently after the object has been stored, or nil.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/sharedCache" title="sharedCache"></a>
	<h3 class="subsubtitle method-title">sharedCache</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>A shared cache.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (instancetype)sharedCache</code></div>

    
	
	
	
	<div class="method-subsection return">
		<h4 class="method-subtitle parameter-title">Return Value</h4>
		<p>The shared singleton cache instance.</p>
	</div>
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/trimToCost:" title="trimToCost:"></a>
	<h3 class="subsubtitle method-title">trimToCost:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Removes objects from the cache, costliest objects first, until the <a href="#//api/name/totalCost">totalCost</a> is below the specified
value. This method blocks the calling thread until the cache has been trimmed.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)trimToCost:(NSUInteger)<em>cost</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>cost</em></dt>
			<dd><p>The total accumulation allowed to remain after the cache has been trimmed.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/trimToCost:block:" title="trimToCost:block:"></a>
	<h3 class="subsubtitle method-title">trimToCost:block:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Removes objects from the cache, costliest objects first, until the <a href="#//api/name/totalCost">totalCost</a> is below the specified
value. This method returns immediately and executes the passed block after the cache has been trimmed,
potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)trimToCost:(NSUInteger)<em>cost</em> block:(TMMemoryCacheBlock)<em>block</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>cost</em></dt>
			<dd><p>The total accumulation allowed to remain after the cache has been trimmed.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>block</em></dt>
			<dd><p>A block to be executed concurrently after the cache has been trimmed, or nil.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/trimToCostByDate:" title="trimToCostByDate:"></a>
	<h3 class="subsubtitle method-title">trimToCostByDate:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Removes objects from the cache, ordered by date (least recently used first), until the <a href="#//api/name/totalCost">totalCost</a> is below
the specified value. This method blocks the calling thread until the cache has been trimmed.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)trimToCostByDate:(NSUInteger)<em>cost</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>cost</em></dt>
			<dd><p>The total accumulation allowed to remain after the cache has been trimmed.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/trimToCostByDate:block:" title="trimToCostByDate:block:"></a>
	<h3 class="subsubtitle method-title">trimToCostByDate:block:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Removes objects from the cache, ordered by date (least recently used first), until the <a href="#//api/name/totalCost">totalCost</a> is below
the specified value. This method returns immediately and executes the passed block after the cache has been
trimmed, potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)trimToCostByDate:(NSUInteger)<em>cost</em> block:(TMMemoryCacheBlock)<em>block</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>cost</em></dt>
			<dd><p>The total accumulation allowed to remain after the cache has been trimmed.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>block</em></dt>
			<dd><p>A block to be executed concurrently after the cache has been trimmed, or nil.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/trimToDate:" title="trimToDate:"></a>
	<h3 class="subsubtitle method-title">trimToDate:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Removes all objects from the cache that have not been used since the specified date.
This method blocks the calling thread until the cache has been trimmed.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)trimToDate:(NSDate *)<em>date</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>date</em></dt>
			<dd><p>Objects that haven&rsquo;t been accessed since this date are removed from the cache.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/trimToDate:block:" title="trimToDate:block:"></a>
	<h3 class="subsubtitle method-title">trimToDate:block:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Removes all objects from the cache that have not been used since the specified date.
This method returns immediately and executes the passed block after the cache has been trimmed,
potentially in parallel with other blocks on the <a href="#//api/name/queue">queue</a>.</p>
	</div>		
	
    

	<div class="method-subsection method-declaration"><code>- (void)trimToDate:(NSDate *)<em>date</em> block:(TMMemoryCacheBlock)<em>block</em></code></div>

    
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>date</em></dt>
			<dd><p>Objects that haven&rsquo;t been accessed since this date are removed from the cache.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>block</em></dt>
			<dd><p>A block to be executed concurrently after the cache has been trimmed, or nil.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">TMMemoryCache.h</code><br />
	</div>				
	
	
</div>
						
					</div>
					
					
				</div>
				<div class="main-navigation navigation-bottom">
					<ul>
	<li><a href="../index.html">Index</a></li>
	<li><a href="../hierarchy.html">Hierarchy</a></li>
</ul>
				</div>
				<div id="footer">
					<hr />
					<div class="footer-copyright">
						<p><span class="copyright">&copy; 2013 Tumblr. All rights reserved. (Last updated: 2013-05-24)</span><br />
						
						<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.1 (build 840)</a>.</span></p>
						
					</div>
				</div>
			</div>
		</article>
		<script type="text/javascript">
			function jumpToChange()
			{
				window.location.hash = this.options[this.selectedIndex].value;
			}
			
			function toggleTOC()
			{
				var contents = document.getElementById('contents');
				var tocContainer = document.getElementById('tocContainer');
				
				if (this.getAttribute('class') == 'open')
				{
					this.setAttribute('class', '');
					contents.setAttribute('class', '');
					tocContainer.setAttribute('class', '');
					
					window.name = "hideTOC";
				}
				else
				{
					this.setAttribute('class', 'open');
					contents.setAttribute('class', 'isShowingTOC');
					tocContainer.setAttribute('class', 'isShowingTOC');
					
					window.name = "";
				}
				return false;
			}
			
			function toggleTOCEntryChildren(e)
			{
				e.stopPropagation();
				var currentClass = this.getAttribute('class');
				if (currentClass == 'children') {
					this.setAttribute('class', 'children open');
				}
				else if (currentClass == 'children open') {
					this.setAttribute('class', 'children');
				}
				return false;
			}
			
			function tocEntryClick(e)
			{
				e.stopPropagation();
				return true;
			}
			
			function init()
			{
				var selectElement = document.getElementById('jumpTo');
				selectElement.addEventListener('change', jumpToChange, false);
				
				var tocButton = document.getElementById('table_of_contents');
				tocButton.addEventListener('click', toggleTOC, false);
				
				var taskTreeItem = document.getElementById('task_treeitem');
				if (taskTreeItem.getElementsByTagName('li').length > 0)
				{
					taskTreeItem.setAttribute('class', 'children');
					taskTreeItem.firstChild.setAttribute('class', 'disclosure');
				}
				
				var tocList = document.getElementById('toc');
				
				var tocEntries = tocList.getElementsByTagName('li');
				for (var i = 0; i < tocEntries.length; i++) {
					tocEntries[i].addEventListener('click', toggleTOCEntryChildren, false);
				}
				
				var tocLinks = tocList.getElementsByTagName('a');
				for (var i = 0; i < tocLinks.length; i++) {
					tocLinks[i].addEventListener('click', tocEntryClick, false);
				}
				
				if (window.name == "hideTOC") {
					toggleTOC.call(tocButton);
				}
			}
			
			window.onload = init;
			
			// If showing in Xcode, hide the TOC and Header
			if (navigator.userAgent.match(/xcode/i)) {
				document.getElementById("contents").className = "hideInXcode"
				document.getElementById("tocContainer").className = "hideInXcode"
				document.getElementById("top_header").className = "hideInXcode"
			}
			
		</script>
	</body>
</html>